<!--我的已办-->
<template>
  <div id="MyFinList" ref="MyFinList">
    <div class="content">
      <van-list v-model="loading" :finished="finished" finished-text="没有更多了">
        <van-search background="#fff" v-model="value1" placeholder="请输入搜索关键词" @search="serachData" />
        <van-cell v-for="(item, index) in contentData" @click="contentClick(item)" :key="index">
          <ul>
            <li>
              <p style="font-weight: bold; margin-bottom: 8px; height: 3vh">
                <span style>{{ item.HOUSEAPPLICANT }}</span>
                <span style="float: right">{{ item.NODE_NAME }}</span>
              </p>
              <p style="font-size: 14px; color: #848484">
                <span style="float: left ;width: 50%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">房屋编号：{{ item.FAMILYHOUSEID || '暂无数据' }}</span>
                <span style="float: right">{{ item.APPLYTIME }}</span>
              </p>
              <p style="clear: both; display: flex; align-items: center">
                <img
                  style="margin-right: 4px"
                  width="10"
                  src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/YPC/dingwei.png"
                />
                <span style="font-size: 14px; color: blue">
                  {{ item.PERMANENTADDR || '暂无数据' }}
                </span>
              </p>
            </li>
          </ul>
        </van-cell>
      </van-list>
      <!-- <ul>
        <li v-for="(item,index) in contentData" @click="contentClick(item)" :key="index">
          <p style="font-weight: bold;margin-bottom: 8px;">
            <span style="">{{item.name}}</span>
            <span style="float: right">{{item.name1}}</span>
          </p>
          <p style="font-size: 14px;color: #848484;">
            <span style="float: left">{{item.BH}}</span>
            <span style="float: right">{{item.time}}</span>
          </p>
          <p style="clear: both;display: flex;align-items: center;">
            <img style="margin-right: 4px;" width="10" src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/YPC/dingwei.png" />
            <span style="font-size: 0.08rem;color:blue">{{item.address}}</span>
          </p>
        </li>
      </ul>-->
    </div>
  </div>
</template>
<script>
import {
  // farmerHouseList,
  QuerySignCallback,
} from '../../utils/api'
import dd from 'gdt-jsapi'
import BScroll from 'better-scroll'
export default {
  data() {
    return {
      loading: false,
      finished: false,
      shenkaobeiData:[],
      contentData: [
        // {
        //   name: '王XX',
        //   name1: "镇街审核",
        //   BH: '房屋编号:4454551554115',
        //   time: '申请时间:2021-12-22',
        //   address: '杭州市临安区太湖源镇里畈村１组里畈27号',
        // },
        // {
        //   name: '王XX',
        //   name1: "镇街审核",
        //   BH: '房屋编号:4454551554115',
        //   time: '申请时间:2021-12-22',
        //   address: '杭州市临安区太湖源镇里畈村１组里畈27号',
        // },
        // {
        //   name: '王XX',
        //   name1: "镇街审核",
        //   BH: '房屋编号:4454551554115',
        //   time: '申请时间:2021-12-22',
        //   address: '杭州市临安区太湖源镇里畈村１组里畈27号',
        // },
        // {
        //   name: '王XX',
        //   name1: "镇街审核",
        //   BH: '房屋编号:4454551554115',
        //   time: '申请时间:2021-12-22',
        //   address: '杭州市临安区太湖源镇里畈村１组里畈27号',
        // },
        // {
        //   name: '王XX',
        //   name1: "镇街审核",
        //   BH: '房屋编号:4454551554115',
        //   time: '申请时间:2021-12-22',
        //   address: '杭州市临安区太湖源镇里畈村１组里畈27号',
        // },
        // {
        //   name: '王XX',
        //   name1: "镇街审核",
        //   BH: '房屋编号:4454551554115',
        //   time: '申请时间:2021-12-22',
        //   address: '杭州市临安区太湖源镇里畈村１组里畈27号',
        // },
        // {
        //   name: '王XX',
        //   name1: "镇街审核",
        //   BH: '房屋编号:4454551554115',
        //   time: '申请时间:2021-12-22',
        //   address: '杭州市临安区太湖源镇里畈村１组里畈27号',
        // },
        // {
        //   name: '王XX',
        //   name1: "镇街审核",
        //   BH: '房屋编号:4454551554115',
        //   time: '申请时间:2021-12-22',
        //   address: '杭州市临安区太湖源镇里畈村１组里畈27号',
        // }
      ],
      value: '',
    }
  },
  mounted() {
    dd.ready(function () {
      dd.setTitle({
        title: '我的已办',
      })
        .then((res) => {})
        .catch((err) => {
          console.error(err)
        })
    })
    this.getcontentData()
  },
  methods: {
    onLoad() {
      this.loading = false
      // 异步更新数据
      // setTimeout 仅做示例，真实场景中一般为 ajax 请求
      setTimeout(() => {
        for (let i = 0; i < 10; i++) {
          this.contentData.push(this.contentData.length + 1)
        }
        // 加载状态结束
        this.loading = false
        // 数据全部加载完成
        if (this.contentData.length >= 40) {
          this.finished = true
        }
      }, 1000)
    },
    serachData(val) {
      if (!val) return this.contentData = this.shenkaobeiData
      this.contentData = this.shenkaobeiData.filter(item => {
        return item.HOUSEAPPLICANT && item.HOUSEAPPLICANT.indexOf(val) > -1
      })
    },
    getcontentData: async function () {
      this.contentData = []
      this.shenkaobeiData=[];
      let params = {
        dataguid: 'f32bc73f-6c62-420f-9262-5a2536263ffa',
        searchObject: [],
        token: window.localStorage.getItem('token'),
      }
      let params1 = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',

        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: params,
      }
      const res = await QuerySignCallback(params1)
      this.contentData = eval('(' + res.data.data + ')').Data
      this.shenkaobeiData = eval('(' + res.data.data + ')').Data
      this.loading = true
      this.finished = true
      this.$nextTick(() => {
        this.scroll = new BScroll(this.$refs.MyFinList, {
          click:true
        })
      })
    },
    onClickLeft() {
      this.$router.push({
        path: '/FeatureList',
      })
    },
    contentClick: async function (item) {
      debugger
      //打开过程界面暂时
       this.$router.push({
        path: '/MyFinListBJ',
        query: { data: JSON.stringify(item) },
      })
    //  this.$router.push({
    //     path: "/DetailPage",
    //     query: { data: item }
    //   });
      // this.$router.push({
      //   path: '/KeyLine',
      //   query: { PROC_GUID: item.PROC_GUID },
      // })
      // let params = {
      //   "dataguid": "8478109f-1194-4126-ab97-b2f927368e7b",
      //   searchObject: JSON.stringify([
      //     { "field": "house_apply.ROW_GUID", "type": "A", "operator": "like", "value": item.ROW_GUID, "link": "AND" },
      //   ]),
      //   token: window.localStorage.getItem('token')
      // }
      // const res = await QuerySignCallback(params)
      // let params1 = {
      //   "dataguid": "15fb50fb-fe82-4306-b54b-3f225cfd1cc4",
      //   searchObject: JSON.stringify([
      //     { "field": "to_row_guid", "type": "A", "operator": "like", "value": item.ROW_GUID, "link": "AND" },
      //   ]),
      //   token: window.localStorage.getItem('token')
      // }
      // const res1 = await QuerySignCallback(params1)
      // this.$router.push({
      //   path: "/DetailPage",
      //   query: { data: res.data.Data, data2: res1.data.Data }
      // });
    },
  },
  // mounted: async function () {
  //   let params = {
  //     "accessCode": "91cf75956e2611ecacdb8c8caa46b312",
  //     "cityCode": "330800000000",
  //     "params": { "dataguid": "f94bce3f-0708-49d6-915e-e46324391c76", "pageNo": "1", "pageSize": "2" }
  //   }
  //   const res = await farmerHouseList(params)
  // }
}
</script>
<style lang="scss" scoped>
#MyFinList {
  height: 100vh;
  overflow: hidden;
  background: #eee;
  font-size: 18px;
  .title {
    width: 100%;
    height: 50px;
    background: #007aff;
    line-height: 50px;
    text-align: center;
    color: #ffffff;
    font-size: 20px;
    position: relative;
  }
  .content {
    height: calc(100vh);
    overflow: auto;
    ul li {
       background-color: white;
      // margin: 14px 10px;
      border-radius: 10px;
      padding: 14px;
      width: 98%;
      margin: 0 auto;
      margin-top: 6px;
      color: black;
      box-shadow: 0 0 12px #e3e3e3;
    }
  }
}
</style>
<style>
#MyFinList .van-cell {
  background-color: #eee !important;
  padding: 4px 10px;
}
</style>
